local joy__shezang = fk.CreateSkill {

  name = "joy__shezang",

  tags = {  },

}



joy__shezang:addEffect(fk.EnterDying, {
  name = "joy__shezang",
  anim_type = "drawcard",
  events = {fk.EnterDying},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(joy__shezang.name) and (target == player or player == player.room.current) and
      player:usedSkillTimes(joy__shezang.name, Player.HistoryTurn) == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local suits = {1, 2, 3, 4}
    local cards = {}
    local pile = table.simpleClone(room.draw_pile)
    while #pile > 0 and #cards < 4 do
      local id = table.remove(pile, math.random(#pile))
      if table.removeOne(suits, Fk:getCardById(id).suit) then
        table.insert(cards, id)
      end
    end
    if #cards > 0 then
      room:moveCards({
        ids = cards,
        to = player.id,
        toArea = Card.PlayerHand,
        moveReason = fk.ReasonPrey,
        proposer = player.id,
        skillName = joy__shezang.name,
        moveVisible = true
      })
    end
  end,
})

return joy__shezang